using System;
using System.Collections.Generic;
using hao_Model.Enums;

namespace hao_Dto
{
    /// <summary>
    /// 创建订单DTO
    /// </summary>
    public class CreateOrderDto
    {
        public Guid ProductId { get; set; }
        public int Quantity { get; set; } = 1;
        public decimal FinalPrice { get; set; }
        public DeliveryMethod DeliveryMethod { get; set; }
        public Guid? BuyerAddressId { get; set; }
        public string BuyerMessage { get; set; }
    }

    /// <summary>
    /// 订单响应DTO
    /// </summary>
    public class OrderResponseDto
    {
        public Guid Id { get; set; }
        public string OrderNumber { get; set; }
        public Guid BuyerId { get; set; }
        public string BuyerName { get; set; }
        public Guid SellerId { get; set; }
        public string SellerName { get; set; }
        public Guid ProductId { get; set; }
        public string ProductTitle { get; set; }
        public decimal ProductPrice { get; set; }
        public decimal FinalPrice { get; set; }
        public int Quantity { get; set; }
        public decimal TotalAmount { get; set; }
        public DeliveryMethod DeliveryMethod { get; set; }
        public string DeliveryMethodName { get; set; }
        public OrderStatus Status { get; set; }
        public string StatusName { get; set; }
        public PaymentStatus PaymentStatus { get; set; }
        public string PaymentStatusName { get; set; }
        public DeliveryStatus DeliveryStatus { get; set; }
        public string DeliveryStatusName { get; set; }
        public string TrackingNumber { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime? PaidAt { get; set; }
        public DateTime? ShippedAt { get; set; }
        public DateTime? DeliveredAt { get; set; }
        public DateTime? CompletedAt { get; set; }
        public string BuyerMessage { get; set; }
        public string SellerMessage { get; set; }
        public User.AddressDto BuyerAddress { get; set; }
    }

    /// <summary>
    /// 订单列表DTO
    /// </summary>
    public class OrderListDto
    {
        public Guid Id { get; set; }
        public string OrderNumber { get; set; }
        public string ProductTitle { get; set; }
        public string ProductImage { get; set; }
        public decimal FinalPrice { get; set; }
        public int Quantity { get; set; }
        public decimal TotalAmount { get; set; }
        public OrderStatus Status { get; set; }
        public string StatusName { get; set; }
        public PaymentStatus PaymentStatus { get; set; }
        public string PaymentStatusName { get; set; }
        public DateTime CreatedAt { get; set; }
        public string BuyerName { get; set; }
        public string SellerName { get; set; }
    }

    /// <summary>
    /// 订单搜索DTO
    /// </summary>
    public class OrderSearchDto
    {
        public string OrderNumber { get; set; }
        public Guid? BuyerId { get; set; }
        public Guid? SellerId { get; set; }
        public Guid? ProductId { get; set; }
        public OrderStatus? Status { get; set; }
        public PaymentStatus? PaymentStatus { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public string Keyword { get; set; }
        public int PageNumber { get; set; } = 1;
        public int PageSize { get; set; } = 10;
        public string SortBy { get; set; } = "CreatedAt";
        public bool SortDesc { get; set; } = true;
    }

    /// <summary>
    /// 支付DTO
    /// </summary>
    public class PaymentDto
    {
        public string PaymentMethod { get; set; }
        public string PaymentAccount { get; set; }
        public string TransactionId { get; set; }
        public decimal Amount { get; set; }
    }

    /// <summary>
    /// 发货DTO
    /// </summary>
    public class ShipmentDto
    {
        public string TrackingNumber { get; set; }
        public string CourierCompany { get; set; }
        public string SellerMessage { get; set; }
    }

    /// <summary>
    /// 取消订单DTO
    /// </summary>
    public class CancelOrderDto
    {
        public string Reason { get; set; }
        public string Remark { get; set; }
    }

    /// <summary>
    /// 物流信息DTO（第三方API返回）
    /// </summary>
    public class TrackingInfoDto
    {
        public string TrackingNumber { get; set; }
        public string CourierCompany { get; set; }
        public DeliveryStatus Status { get; set; }
        public string StatusDescription { get; set; }
        public List<TrackingEventDto> Events { get; set; }
        public DateTime? EstimatedDelivery { get; set; }
    }

    /// <summary>
    /// 物流事件DTO
    /// </summary>
    public class TrackingEventDto
    {
        public DateTime Time { get; set; }
        public string Location { get; set; }
        public string Description { get; set; }
    }

    /// <summary>
    /// 订单统计DTO
    /// </summary>
    public class OrderStatisticsDto
    {
        public int TotalOrders { get; set; }
        public int PendingOrders { get; set; }
        public int CompletedOrders { get; set; }
        public int CancelledOrders { get; set; }
        public decimal TotalAmount { get; set; }
        public decimal TodayAmount { get; set; }
        public decimal MonthAmount { get; set; }
    }

    /// <summary>
    /// 订单日统计DTO
    /// </summary>
    public class OrderDailyStatsDto
    {
        public DateTime Date { get; set; }
        public int OrderCount { get; set; }
        public decimal TotalAmount { get; set; }
        public int CompletedCount { get; set; }
        public int CancelledCount { get; set; }
    }

    /// <summary>
    /// 卖家确认订单DTO
    /// </summary>
    public class SellerConfirmDto
    {
        public string SellerMessage { get; set; }
    }
}